package com.ruoyi.qiushi.service.mall.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.qiushi.domain.mall.QiushiBanner;
import com.ruoyi.qiushi.mapper.mall.QiushiBannerMapper;
import com.ruoyi.qiushi.service.mall.IQiushiBannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * bannerService业务层处理
 *
 * @author ruoyi
 * @date 2024-01-16
 */
@Service
public class QiushiBannerServiceImpl implements IQiushiBannerService {
    @Autowired
    private QiushiBannerMapper qiushiBannerMapper;

    /**
     * 查询banner
     *
     * @param id banner主键
     * @return banner
     */
    @Override
    public QiushiBanner selectQiushiBannerById(Long id) {
        return qiushiBannerMapper.selectQiushiBannerById(id);
    }

    /**
     * 查询banner列表
     *
     * @param qiushiBanner banner
     * @return banner
     */
    @Override
    public List<QiushiBanner> selectQiushiBannerList(QiushiBanner qiushiBanner) {
        return qiushiBannerMapper.selectQiushiBannerList(qiushiBanner);
    }

    /**
     * 新增banner
     *
     * @param qiushiBanner banner
     * @return 结果
     */
    @Override
    public int insertQiushiBanner(QiushiBanner qiushiBanner) {
        qiushiBanner.setCreateTime(DateUtils.getNowDate());
        return qiushiBannerMapper.insertQiushiBanner(qiushiBanner);
    }

    /**
     * 修改banner
     *
     * @param qiushiBanner banner
     * @return 结果
     */
    @Override
    public int updateQiushiBanner(QiushiBanner qiushiBanner) {
        qiushiBanner.setUpdateTime(DateUtils.getNowDate());
        return qiushiBannerMapper.updateQiushiBanner(qiushiBanner);
    }

    /**
     * 批量删除banner
     *
     * @param ids 需要删除的banner主键
     * @return 结果
     */
    @Override
    public int deleteQiushiBannerByIds(Long[] ids) {
        return qiushiBannerMapper.deleteQiushiBannerByIds(ids);
    }

    /**
     * 删除banner信息
     *
     * @param id banner主键
     * @return 结果
     */
    @Override
    public int deleteQiushiBannerById(Long id) {
        return qiushiBannerMapper.deleteQiushiBannerById(id);
    }
}
